package com.sairobo.admin.modules.srblive.controller;

import com.sairobo.base.common.annotation.SysLog;
import com.sairobo.base.common.entity.Page;
import com.sairobo.base.common.entity.R;
import com.sairobo.admin.modules.srblive.entity.LiveXcxCourses;
import com.sairobo.admin.modules.srblive.service.LiveXcxCoursesService;
import com.sairobo.base.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 
 *
 * @author admin
 * @email sairobo
 * @url www.sairobo.com
 * @date 2018年1月22日 上午11:48:30
 */
@RestController
@RequestMapping("/srblive/courses")
public class LiveXcxCoursesController extends AbstractController {
	
	@Autowired
	private LiveXcxCoursesService liveXcxCoursesService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<LiveXcxCourses> list(@RequestBody Map<String, Object> params) {
		return liveXcxCoursesService.listLiveXcxCourses(params);
	}
		
	/**
	 * 新增
	 * @param liveXcxCourses
	 * @return
	 */
	@SysLog("新增")
	@RequestMapping("/save")
	public R save(@RequestBody LiveXcxCourses liveXcxCourses) {
		return liveXcxCoursesService.saveLiveXcxCourses(liveXcxCourses);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody Long id) {
		return liveXcxCoursesService.getLiveXcxCoursesById(id);
	}
	
	/**
	 * 修改
	 * @param liveXcxCourses
	 * @return
	 */
	@SysLog("修改")
	@RequestMapping("/update")
	public R update(@RequestBody LiveXcxCourses liveXcxCourses) {
		return liveXcxCoursesService.updateLiveXcxCourses(liveXcxCourses);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody Long[] id) {
		return liveXcxCoursesService.batchRemove(id);
	}


    /**
     * 获取系列课列表
     * @return
     */
    @SysLog("获取系列课列表")
    @RequestMapping("/getSeriesList")
    public R getSeriesList() {
        return liveXcxCoursesService.getSeriesList();
    }


    /**
     * 上下架--0：待上架 1：已上架  2：已下架  3：已删除
     * @param id
     * @return
     */
    @SysLog("上下架")
    @RequestMapping("/setStatus")
    public R setStatus(Long id,Integer status) {
        return liveXcxCoursesService.setStatus(id,status);
    }
	
}
